libcal.a:add.o sub.o
	ar -rc $@ $^
	rm *.o
%.o:%.c
	gcc -c $<

libcal.so:sub.o add.o
	gcc -shared -o $@ $^
%.o:%.c
	gcc -c -fPIC $<

.PHONY:clean
clean:
	rm -rf *.o libcal.so mylib libcal.a

.PHONY:output
output:
	mkdir -p mylib/include
	mkdir -p mylib/lib 
	cp -f *.a mylib/lib
	cp -f *.h mylib/include
	cp -f *.so mylib/lib
	tar czf mylib.tgz mylib
